<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<title>订单导入模版设置</title>
<script type="text/javascript">
	function setParam() {
		var keys = $("#keys").val();
		var values = $("#values").val();
		if (keys == null || values == null) {
			return;
		}
		$("#keys option[value='" + keys + "']").remove();
		$("#values option[value='" + values + "']").remove();
		$("#content").prepend("<option value='" + values + "'>" + keys + "</option>");

	}

	function getParam() {
		var tempString = "";
		$("#content option").each(function() {
			var text = $(this).text();
			var value = $(this).val();

			if ("" == tempString) {
				tempString = text + ":" + value;
			} else {
				tempString += "," + text + ":" + value;
			}
		});
		return tempString;
	}

	function ajaxLeadCusromerParam(customerCode, type, params) {
		$.ajax({
			type : 'post',
			url : '${ctx}/focusLeadOrdeno/ajaxLeadCusromerParam',
			data : 'customerCode=' + customerCode + '&params=' + params + '&type=' + type,
			dataType : 'json',
			success : function(data) {
				alert(data.content);
			},
			error : function() {
				alert("获取信息错误！");
			}
		});
	}

	function ajaxParam() {
		var params = getParam();
		ajaxLeadCusromerParam('${customerCode}', '${type}', params);
	}
</script>
</head>

<body>
	<div class="row">
		<div class="col-md-12" style="height: 600px;">
			<div class="col-sm-3">
				<select id="keys" name="keys" multiple="multiple" class="oldSelectStyle" style="height: 600px; width:180px;">
					<c:forEach items="${keys}" var="key">
						<option value="${key}">${key}</option>
					</c:forEach>
				</select>
			</div>
			<div class="col-sm-3">
				<select id="values" name="values" multiple="multiple" class="oldSelectStyle" style="height: 600px; width:180px;">
					<c:choose>
						<c:when test="${type eq 'sku'}">
							<option value="sku">SKU编码</option>
							<option value="bar">货号</option>
							<option value="haikwanCode">海关商品编码</option>
							<option value="originCountry">原产国</option>
							<option value="tbSkuid">来源单号</option>
							<option value="col">颜色</option>
							<option value="siz">尺寸</option>
							<option value="len">长度</option>
							<option value="wid">宽度</option>
							<option value="hei">高度</option>
							<option value="vol">体积</option>
							<option value="weight">商品重量</option>
							<option value="weightPkg">包装重量</option>
							<option value="skuName">商品名称</option>
							<option value="spec">规格代码</option>
							<option value="weightPop">泡重</option>
							<option value="unitPrice">单价</option>
							<option value="currency">币制</option>
							<option value="brandCode">品牌代码</option>
							<option value="brandName">品牌名称</option>
							<option value="unit">单位</option>
							<option value="sellFlg">非赠品</option>
							<option value="isBatchMgmt">批次管理</option>
							<option value="isShelfLifeMgmt">日期管理</option>
						</c:when>
						<c:otherwise>
							<option value="customerOrdeno">商家订单号</option>
							<option value="fromno">来源单号</option>
							<option value="receIdNumber">收件人身份证号</option>
							<option value="recena">收件人名称</option>
							<option value="receCountry">收件人所在国</option>
							<option value="seawayMailNumber">行邮税号</option>
							<option value="haikwanCode">海关编码Hscode</option>
							<option value="addres">收件人地址</option>
							<option value="provna">省份名称</option>
							<option value="provco">省份编码</option>
							<option value="cityna">市名称</option>
							<option value="cityco">市编码</option>
							<option value="distna">区名称</option>
							<option value="distco">区编码</option>
							<option value="mobile">手机号码</option>
							<option value="teleph">固定电话</option>
							<option value="totalAmount">订单总金额</option>
							<option value="caname">物流公司名称</option>
							<option value="cacode">物流公司编码</option>
							<option value="shopna">店铺名称</option>
							<option value="shopCode">店铺编码</option>
							<option value="bunick">会员名称</option>
							<option value="postco">邮政编码</option>
							<!-- <option value="customerCode">客户编码</option> -->
							<option value="waybillNo">能容运单号</option>
							<option value="sku">商品SKU编码</option>
							<option value="articleNumber">商品货号</option>
							<option value="nam">商品名称</option>
							<option value="pri">商品价格</option>
							<option value="spec">规格代码</option>
							<option value="qty">商品数量</option>
							<option value="suttleWeight">净重</option>
							<option value="grossWeight">毛重</option>
							<option value="currency">币制</option>
							<option value="placeOrderTime">订单时间</option>
							<option value="unit">单位</option>
							<option value="remark">备注</option>
						</c:otherwise>
					</c:choose>
				</select>
			</div>
			<div class="col-sm-6">
				<table style="height: 600px;">
			         <tr>
			             <td> 
			               <input type="button" class="btn btn-primary" value=">>>>" onclick="setParam();"/>
			             </td>
			             <td style="width: 60px;"></td>
			             <td>
			                <select id="content" name="content"  multiple="multiple" style="height: 600px; width:180px;"class="oldSelectStyle"></select>
			             </td>
			          </tr>
		       </table>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-sm-6">
			<input id="submit_btn" class="btn btn-primary" type="button" value="设置" onclick="ajaxParam()" />
			<input id="cancel_btn" class="btn" type="button" value="返回" onclick="history.back()" />
		</div>
	</div>
</body>

</html>